IsInRange(T) Method (ConditionValidator(T), T, T, String)

CuttingEdge.Conditions

Checks whether the given value is between minValue and maxValue (including those values). An exception is thrown otherwise.

Namespace:  CuttingEdge.Conditions
Assembly:  CuttingEdge.Conditions (in CuttingEdge.Conditions.dll)

Syntax

Visual Basic (Declaration)
Public Shared Function IsInRange(Of T As IComparable) ( _
	validator As ConditionValidator(Of T), _
	minValue As T, _
	maxValue As T, _
	conditionDescription As String _
) As ConditionValidator(Of T)
C#
public static ConditionValidator<T> IsInRange<T>(
	ConditionValidator<T> validator,
	T minValue,
	T maxValue,
	string conditionDescription
)
where T : IComparable
Visual C++
public:
generic<typename T>
where T : IComparable
static ConditionValidator<T>^ IsInRange(
	ConditionValidator<T>^ validator, 
	T minValue, 
	T maxValue, 
	String^ conditionDescription
)
JavaScript
JavaScript does not support generic types or methods.

Parameters

validator
Type: CuttingEdge.Conditions..::.ConditionValidator<(Of <(T>)>)
The ConditionValidator<(Of <(T>)>) that holds the value that has to be checked.
minValue
Type: T
The lowest valid value.
maxValue
Type: T
The highest valid value.
conditionDescription
Type: System..::.String
The description of the condition that should hold. The string may hold the placeholder '{0}' for the ArgumentName.

Type Parameters

T
The type of the Value of the specified validator.

Return Value

The specified validator instance.

Exceptions

ExceptionCondition
System..::.ArgumentOutOfRangeExceptionThrown when the Value of the specified validator is not in the specified range, while the specified validator is created using the Requires extension method.
System.ComponentModel..::.InvalidEnumArgumentExceptionThrown when the Value of the specified validator is not in the specified range and is an Enum type, while the specified validator is created using the Requires extension method.
CuttingEdge.Conditions..::.PostconditionExceptionThrown when the Value of the specified validator is not in the specified range, while the specified validator is created using the Ensures extension method.

See Also